'\" te
.\"  Copyright (c) 2007 Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SIP_CREATE_RESPONSE 3SIP "Jan 25, 2007"
.SH NAME
sip_create_response \- create a response for a SIP request
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsip\fR [ \fIlibrary\fR ... ]
#include <sip.h>

\fBsip_msg_t\fR \fIsip_create_response\fR(\fBsip_msg_t\fR \fIsip_request\fR,
     \fBint\fR \fIresponse_code\fR, \fBchar *\fR\fIresponse_phase\fR,
     \fBchar *\fR\fItotag\fR, \fBchar *\fR\fIcontact_uri\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBsip_create_response()\fR function creates and returns a \fBSIP\fR
message in response to the \fBSIP\fR request \fIsip_request\fR. The response
line in the resulting \fBSIP\fR message is created using the response code in
\fIresponse_code\fR and the phrase in \fIresponse_phrase\fR. The response line
has the \fBSIP\fR-Version of "2.0". If a non-null \fItotag\fR is specified, the
resulting \fBSIP\fR response has a \fBTO\fR header with a tag value from
\fItotag\fR. If \fItotag\fR is null and the \fIresponse_code\fR is anything
other than \fB100\fR (\fBTRYING\fR), \fBsip_create_response()\fR adds a
\fBTO\fR header with a randomly generated tag value. If the \fIresponse_code\fR
is \fB100\fR and \fItotag\fR is null, the \fBSIP\fR response has a \fBTO\fR
header without a tag parameter. If \fIcontact_uri\fR is non-null, a
\fBCONTACT\fR header is added to the \fBSIP\fR response with the \fBURI\fR
specified in \fIcontact_uri\fR. The \fBSIP\fR response has the following
headers copied from \fIsip_request\fR:
.br
.in +2
All \fBVIA\fR headers
.in -2
.br
.in +2
\fBFROM\fR header
.in -2
.br
.in +2
\fBTO\fR header (with tag added, if required, as stated above)
.in -2
.br
.in +2
\fBCALL-ID\fR header
.in -2
.br
.in +2
\fBCSEQ\fR header
.in -2
.br
.in +2
All \fBRECORD-ROUTE\fR headers
.in -2
.SH RETURN VALUES
.sp
.LP
The \fBsip_create_response()\fR function returns the resulting \fBSIP\fR
message on success and \fBNULL\fR on failure.
.sp
.LP
The value of \fBerrno\fR is not changed by these calls in the event of an
error.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR libsip (3LIB)
